<template>
  <div id="mainView">
    <el-container style="width:100%">
      <el-header class="header">
        <div class="header_title">员工管理系统</div>
        <el-button @click="clickLogout">退出登录</el-button>
      </el-header>
      <el-container>
        <el-aside style="width: 200px;background: #F0F0F0">
          <el-menu :default-openeds="['/staff']" :default-active="$route.path" router>
            <el-submenu index="/staff">
              <template slot="title"><i class="el-icon-s-custom"></i>员工管理</template>
              <el-menu-item index="/staff">员工信息</el-menu-item>
              <el-menu-item index="/review">打卡信息</el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "MainView",
  methods: {
    clickLogout: function () {
      let that = this
      this.$http.post("/base/admin/logout").then(function () {
        that.$router.push({
          path: "/login"
        })
      })
    }
  }
}
</script>

<style scoped>
.el-icon-user {
  margin-left: 10px;
  color: white;
}

.header_user {
  display: flex;
  flex-flow: row;
  font-size: 16px;
  align-items: center;
  cursor: pointer;
  color: white;
}

.header_title {
  font-size: 26px;
  color: white;
  font-weight: bold;
}

.header {
  width: 100%;
  height: 60px;
  background: #409EFF;
  display: flex;
  flex-flow: row;
  justify-content: space-between;
  align-items: center;
}

#mainView {
  width: 100%;
  height: 100%;
  display: flex;
  flex-flow: column;
}
</style>
